ND scans: rebased on main, with finalization-crash and pipe_planner fixes - #930
ND scans: rebased on main, with finalization-crash and pipe_planner fixes#930alongd wants to merge 5 commits into
Conversation
|
|
||
|
|
||
| import arc.parser.parser as parser | ||
| import arc.scheduler as sched_module |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #930 +/- ##
==========================================
+ Coverage 64.11% 64.88% +0.76%
==========================================
Files 119 120 +1
Lines 39539 40376 +837
Branches 10261 10415 +154
==========================================
+ Hits 25352 26198 +846
+ Misses 11213 11123 -90
- Partials 2974 3055 +81
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR rebases and integrates the ND rotor-scan work (superseding #855) onto current main, adds an ESS finalization crash fix, fixes a pipe-mode initialization-order issue in Scheduler.__init__, and introduces adaptive sparse 2D scan support end-to-end (scan utilities, scheduler orchestration, plotting, and tests).
Changes:
- Added
arc/species/nd_scan.pyto centralize ND scan utilities and implement adaptive sparse 2D scanning, validation, coupling metrics, and classification. - Updated
arc/scheduler.pyto use the new ND-scan utilities, fix ESS scan finalization, support adaptive batching, and fix pipe planner/coordinator initialization ordering. - Added sparse/adaptive 2D plotting support in
arc/plotter.py, plus extensive unit/functional tests and an xTB directed-scan--optfix.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| arc/species/nd_scan.py | New ND scan utility module including adaptive sparse 2D scanning, validation, and classification helpers. |
| arc/species/nd_scan_test.py | New unit tests covering dense/continuous/adaptive scan utilities, validation, and classification. |
| arc/scheduler.py | Integrates ND scan module, adds adaptive scan orchestration, fixes ESS finalization crash, and adjusts pipe init ordering. |
| arc/scheduler_test.py | Adds functional directed-scan tests (dense + adaptive) using xTB, and related helpers. |
| arc/plotter.py | Adds sparse/adaptive 2D plotting path (interpolation + overlays) and fixes axis limit setting bugs. |
| arc/plotter_test.py | Adds tests for sparse plotting helpers and non-crashing plot generation. |
| arc/job/adapters/xtb_adapter.py | Ensures directed_scan jobs that are optimization scans pass --opt to xTB. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if 'brute_force' in job.directed_scan_type: | ||
| # Just terminated a brute_force directed scan job. | ||
| # Are there additional jobs of the same type currently running for this species? | ||
| self.species_dict[label].rotors_dict[job.rotor_index]['number_of_running_jobs'] -= 1 | ||
| if not self.species_dict[label].rotors_dict[job.rotor_index]['number_of_running_jobs']: | ||
| # All brute force scan jobs for these pivots terminated. | ||
| logger.info(f'\nAll brute force directed scan jobs for species {label} between ' | ||
| f'pivots {job.pivots} successfully terminated.\n') | ||
| self.process_directed_scans(label, pivots=job.pivots) | ||
| rotor_dict = self.species_dict[label].rotors_dict[job.rotor_index] | ||
| all_done = decrement_running_jobs(rotor_dict) | ||
| if all_done: |
| xs, ys, energies = [], [], [] | ||
| for key, entry in results.get('directed_scan', {}).items(): | ||
| e = entry.get('energy') | ||
| if e is not None: | ||
| xs.append(float(key[0])) | ||
| ys.append(float(key[1])) | ||
| energies.append(float(e)) | ||
| summary = results.get('adaptive_scan_summary', {}) |
f8ebb3b to
80a5e29
Compare
Contains pure scan-surface helpers
Scheduler.__init__ calls run_scan_jobs() from its per-species restart loop,
and run_scan_jobs dereferences self.pipe_planner via try_pipe_rotor_scans_1d().
The planner was constructed after that loop, so restarting a project with
pending 1D rotor scans raised:
AttributeError: 'Scheduler' object has no attribute 'pipe_planner'
Construction now happens before the restart loop. Both PipeCoordinator and
PipePlanner only store references in __init__, so early construction is safe.
This is a latent bug on main (main:464/487/511 call run_scan_jobs; main:521
assigns pipe_planner); it was surfaced by the ND scan functional tests, which
are the first tests to exercise that construction path.
80a5e29 to
9bf5748
Compare
Summary
This PR supersedes/complements #855. It is #855's four commits (
Added the ND Scan module,Added directed scan to xTB job adapter,Added ND scan functionalities to plotter,Adaptations to Scheduler) rebased onto currentmain(263 commits of drift since #855 was opened), plus two additional fixes:finalize_directed_scan_results(see review comment on Refactor ND scan subsystem with adaptive sparse 2D sampling, surface validation, and coupling classification #855 for details).pipe_plannerinitialization-order bug inScheduler.__init__.#855 should not be force-pushed or rebased in place — its branch (
nd_scans) is currently checked out in a live, long-running working session with uncommitted local patches, and rewriting it there would destroy that work. This PR exists so the rebased/fixed history can be reviewed and landed without touchingnd_scans.Detailed review findings (conflict-resolution notes, two latent bugs found on
main, the finalization-crash fix, and several design questions worth discussing) are posted as a comment on #855.Closes/relates to #855.
Test plan